@extends('www/zc-666/layout')
@section('title',$activity->title)

@section('content')
<div class="order">

    @include('/www/zc-666/web/ad')

    {{--主题框架--}}
    <div class="main-content-box">

        {{--众筹进度--}}
        <div class="progress">
            <div class="percent-box">
                {{--灰色背景--}}
                <p class="bg"></p>
                {{--橙色进度--}}
                @if($percent > 0)
                    <p class="percent" style="width: {{$percent}}%"></p>
                @endif
                {{--椭圆数字--}}
                @if ($percent < 80 )
                    <p class="num" style="left: {{$percent + 2}}%;">{{$percent}}%</p>
                @else
                    <p class="num" style="left: 80%;">{{$percent}}%</p>
                @endif
            </div>
        </div>

        {{--数字信息--}}
        @include('/www/zc-666/web/num',[
            'k1' => '众筹资金',
            'k2' => '剩余金额',
            'k3' => '已筹资金',
            'v1' => $activity->money . '元',
            'v2' => $orderInfo->surplusMoney . '元',
            'v3' => $orderInfo->raised_money. '元'
        ])

        {{--头像信息--}}
        @include('/www/zc-666/web/head', [
            'img' => $orderInfo->wx_head,
            'name' => $orderInfo->wx_name,
            'time' => $orderInfo->created_at
        ])

        @include('/www/zc-666/web/activity2',[
              'title' => '教导模式全球总裁联动班',
              'title1'=> $activity->title,
              'day'   => $subTime[0],
              'hour'  => $subTime[1],
              'min'   => $subTime[2],
              'sec'   => $subTime[3]
          ])

        {{--众筹人员列表--}}
        <div class="people-list-box">
            <div class="people-list" id="detail-all">
                <?php $total = count($supports); ?>
                <p class="title" style="text-align: center;">{{ $total > 0 ? '支持金额排行榜' : '暂无支持者'}}</p>
                @if($total > 0)
                <div class="flex people-row" onclick="location.href = 'messages?orderId={{$orderInfo->id}}'">
                    @foreach($supports as $i => $support)
                        @if($i<6)
                        <div class="flex1 text-center">
                            {{--背景框--}}
                            <div class="supports-people head-box" style="background-image: url('{{$support->wx_head}}')">
                                {{--头像--}}
                                @if($i<3)
                                <img class="head-img" src="/www/zc666/web/img/{{$i}}.png" alt="">
                                @endif
                            </div>
                            <p class="pay-money">￥{{$support->pay_money}}</p>
                        </div>
                        @endif
                    @endforeach
                </div>
                <p class="text-center text-orange" style="font-size:3vw;margin-top:3vw;" onclick="location.href = 'messages?orderId={{$orderInfo->id}}'">更多支持者详情 ></p>
                @endif
            </div>
        </div>

        {{--详细信息--}}
        @include('/www/zc-666/web/content')
    </div>


    @if(!$isManager)
        <div style="height:10.5vw;"></div>
    @endif

    <div class="pay-share-btn @if($isManager) hide @endif ">
        {{--没有退款--}}
        @if($orderInfo->refunded_at != null)
            @if(!$selfOrder)
                <a class="pay un" onclick="return false;">我要众筹</a>
            @endif
                <a class="pay un" onclick="return false;">众筹失败</a>
        @else
            {{--@if($orderInfo->surplusTime > 0)
                @if($percent < 100)
                    <a class="pay" href="/www/zhongchou666/pay_page?orderId={{$orderInfo->id}}">支持TA</a>
                @else
                    <a class="pay un" onclick="return notice.alert('众筹已成功，谢谢！推荐您去参加喔~~');">支持TA</a>
                @endif
            @else

                @if($percent < 100 && $orderInfo->open_id == $userInfo['openid'])
                    <a class="pay un" onclick="return order.yanshi({{$orderInfo->id}});">延长时间</a>
                @else
                    <a class="pay un" onclick="return notice.alert('众筹已超时');">支持TA</a>
                @endif
            @endif--}}

            {{--右边按钮 如果页面是自己：邀请支持 他人：支持他--}}
            @if($selfOrder)
                <a  class="bm" onclick="return notice.alert('点击右上角分享给好友');">邀请支持</a>
            @else

                <a class="pay un" href="/www/zhongchou666/enter?fun=register&activityId={{$orderInfo->activity_id}}&orderId={{$orderInfo->id}}">我要众筹</a>

                @if($percent < 100)
                    <a class="pay" href="/www/zhongchou666/pay_page?orderId={{$orderInfo->id}}">支持TA</a>
                @else
                    <a class="pay" href="javascript: return false;">众筹成功</a>
                @endif
            @endif
        @endif
    </div>
</div>


{{--分享提示--}}
<div class="share-bg zhezhao">
    <div>
        <span class="share-close" onclick="$('.share-bg').hide();"></span>
        @if($selfOrder)
            <img src="/www/zc666/images/common/self-share.png">
        @else
            <img src="/www/zc666/images/common/other-share.png">
        @endif
    </div>
</div>

<script>
    window.onload = function(){

        // show_ppt("slidr-img");

       //order.fresh_time({{$orderInfo->surplusTime}})

        @if($selfOrder)
            const title   = "我是{{$orderInfo->real_name}}，感谢您的支持";
            // const desc    = "{{$activity->share_desc}}";
            const desc    = "我正在众筹教导模式全球总裁联动班，希望能得到您的支持，谢谢！";
        @else
            const title   = "教导模式全球总裁联动班";
            // const desc    = "{{$activity->share_desc}}";
            const desc    = "我的好友{{$orderInfo->real_name}}正在众筹教导模式全球总裁联动班，希望能得到您的支持，谢谢！";
        @endif

        const groupTitle = title;
        const link    = appRoot + "www/zhongchou666/order?orderId={{$orderInfo->id}}";
        const imgUrl  = appRoot + "{{$activity->share_img}}";

        @if(is_online() && is_weixin())
            wx.config(<?php echo $weixinJs->config(array('onMenuShareAppMessage', 'onMenuShareTimeline'), false) ?>);
            wx.ready(function(){
                set_wx_share(title,groupTitle,desc,imgUrl,link);
            });
        @endif
}
</script>
@endsection
